package net.keebook.webapp.util;

import java.util.Locale;
import java.util.ResourceBundle;

import javax.faces.context.FacesContext;

public class MessageBundle {
	private static final Locale DEFAULT_LOCALE = new Locale("en", "US");
	
	public static ResourceBundle get() {
		Locale locale;
		if (FacesContext.getCurrentInstance() != null) {
			locale = FacesContext.getCurrentInstance().getViewRoot().getLocale();
		} else {
			locale = DEFAULT_LOCALE;
		}
		return ResourceBundle.getBundle("MessagesBundle", locale);
	}
}
